home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / Oberon⁄F™ 1.2 / Preinstalled version / Form / Docu / Models (.txt) < prev    next >
Encoding:
Oberon Document  |  1996-07-08  |  9.3 KB  |  223 lines  |  [oODC/obnF]

  1. Documents.StdDocumentDesc
  2. Documents.DocumentDesc
  3. Containers.ViewDesc
  4. Views.ViewDesc
  5. Stores.StoreDesc
  6. Documents.ModelDesc
  7. Containers.ModelDesc
  8. Models.ModelDesc
  9. Stores.ElemDesc
  10. TextViews.StdViewDesc
  11. TextViews.ViewDesc
  12. TextModels.StdModelDesc
  13. TextModels.ModelDesc
  14. TextModels.AttributesDesc
  15. Helvetica
  16. TextRulers.StdRulerDesc
  17. TextRulers.RulerDesc
  18. TextRulers.StdStyleDesc
  19. TextRulers.StyleDesc
  20. TextRulers.AttributesDesc
  21. Helvetica
  22. Helvetica
  23. Helvetica
  24. Helvetica
  25. FormModels
  26. DEFINITION FormModels;
  27.     IMPORT Ports, Models, Views, Containers;
  28.     CONST minView Size = 4 * Ports.point; maxViewSize = 160 * Ports.mm;
  29.     TYPE
  30.         Model = POINTER TO ModelDesc;
  31.         ModelDesc = RECORD (Containers.ModelDesc)
  32.             PROCEDURE (m: Model) Insert (v: Views.View; l, t, r, b: LONGINT);
  33.             PROCEDURE (m: Model) Delete (v: Views.View);
  34.             PROCEDURE (m: Model) Resize (v: Views.View; l, t, r, b: LONGINT);
  35.             PROCEDURE (m: Model) PutAbove (v, p: Views.View);
  36.             PROCEDURE (m: Model) Move (v: Views.View; dx, dy: LONGINT);
  37.             PROCEDURE (m: Model) Copy (VAR v: Views.View; dx, dy: LONGINT);
  38.             PROCEDURE (m: Model) NewReader (old: Reader): Reader;
  39.             PROCEDURE (m: Model) NewWriter (old: Writer): Writer;
  40.             PROCEDURE (m: Model) ViewAt (x, y: LONGINT): Views.View;
  41.             PROCEDURE (m: Model) NofViews (): INTEGER
  42.         END;
  43.         Directory = POINTER TO DirectoryDesc;
  44.         DirectoryDesc = RECORD
  45.             PROCEDURE (d: Directory) New (): Model
  46.         END;
  47.         Context = POINTER TO ContextDesc;
  48.         ContextDesc = RECORD (Models.ContextDesc)
  49.             PROCEDURE (c: Context) ThisModel (): Model;
  50.             PROCEDURE (c: Context) GetRect (VAR l, t, r, b: LONGINT)
  51.         END;
  52.         Reader = POINTER TO ReaderDesc;
  53.         ReaderDesc = RECORD
  54.             view: Views.View;
  55.             l, t, r, b: LONGINT;
  56.             PROCEDURE (r: Reader) Set (p: Views.View);
  57.             PROCEDURE (r: Reader) ReadView (VAR v: Views.View)
  58.         END;
  59.         Writer = POINTER TO WriterDesc;
  60.         WriterDesc = RECORD
  61.             PROCEDURE (w: Writer) Set (p: Views.View);
  62.             PROCEDURE (w: Writer) WriteView (v: Views.View; l, t, r, b: LONGINT)
  63.         END;
  64.         UpdateMsg = RECORD (Models.UpdateMsg)
  65.             l, t, r, b: LONGINT
  66.         END;
  67.     VAR dir-, stdDir-: Directory;
  68.     PROCEDURE GetRect (v: Views.View; VAR l, t, r, b: LONGINT);
  69.     PROCEDURE New (): Model;
  70.     PROCEDURE Clone (source: Model): Model;
  71.     PROCEDURE Copy (source: Model): Model;
  72.     PROCEDURE SetDir (d: Directory);
  73. END FormModels.
  74. FormModels are container models which contain views. They have no further intrinsic contents. Form models can be used to arrange rectangular views in arbitrary layouts. Their main use is as data entry forms and as dialog layouts.
  75. CONST minViewSize
  76. This is the minimal width and height of a view which is embedded in a form model.
  77. CONST maxViewSize
  78. This is the maximal width and height of a view which is embedded in a form model.
  79. TYPE Model
  80. Interface, Extension
  81. Form models are container models (containers are not described here), which contain rectangular views and nothing else.
  82. PROCEDURE (m: Model) Insert (v: Views.View; l, t, r, b: LONGINT)
  83. Interface, Operation
  84. Insert view v with bounding box (l, t, r, b).
  85. v # NIL    20
  86. v.context = NIL    22
  87. l <= r    23
  88. t <= b    24
  89. v in m
  90. v.context # NIL & v.context.ThisModel() = m
  91. PROCEDURE (m: Model) Delete (v: Views.View)
  92. Interface, Operation
  93. Remove v from m.
  94. v in m    20
  95. ~(v in m)
  96. PROCEDURE (m: Model) Resize (v: Views.View; l, t, r, b: LONGINT)
  97. Interface, Operation
  98. Redefine bounding box of v.
  99. v in m    20
  100. l <= r    21
  101. t <= b    22
  102. PROCEDURE (m: Model) PutAbove (v, p: Views.View)
  103. Interface, Operation
  104. Change the vertical order of view v, such that it comes to lie directly above p if p # NIL, otherwise it is put to the bottom of the view list.
  105. v in m    20
  106. p = NIL  OR  p in f    21
  107. PROCEDURE (m: Model) Move (v: Views.View; dx, dy: LONGINT)
  108. Interface, Operation
  109. Move view v by (dx, dy), without changing its size.
  110. v in m    20
  111. PROCEDURE (m: Model) Copy (VAR v: Views.View; dx, dy: LONGINT)
  112. Interface, Operation
  113. Create a copy of v and put it at v's bounding box shifted by (dx, dy). Parameter v returns the copy.
  114. v # NIL    20
  115. v.context # NIL    21
  116. v.context.ThisModel() = m    22
  117. v # NIL  &  v # v'
  118. PROCEDURE (m: Model) ReplaceView (old, new: Views.View)
  119. Interface, Extension, Operation
  120. Retain the context of old, but replace old by new.
  121. old # NIL    20
  122. new # NIL    21
  123. old.context # NIL    22
  124. new.context = NIL  OR  new.context = old.context    23
  125. new.context = old.context
  126. PROCEDURE (m: Model) NewReader (old: Reader): Reader
  127. Returns a reader connected to f. An old reader may be passed as input parameter, if it isn't in use anymore.
  128. result # NIL
  129. PROCEDURE (m: Model) NewWriter (old: Writer): Writer
  130. Returns a writer connected to m. An old writer may be passed as input parameter, if it isn't in use anymore.
  131. result # NIL
  132. PROCEDURE (m: Model) ViewAt (x, y: LONGINT): Views.View
  133. Returns the topmost view in m which encloses position (x, y).
  134. result # NIL
  135.     where (l, t, r, b) is the bounding box of v: (l <= x <= r) & (t <= y <= b)
  136. result = NIL
  137.     no view at (x, y)
  138. PROCEDURE (m: Model) NofViews (): INTEGER
  139. Returns the number of views currently in m.
  140. result >= 0
  141. TYPE Directory
  142. Interface
  143. Directory for the allocation of concrete form models.
  144. PROCEDURE (d: Directory) New (): Model
  145. Interface
  146. Create and return a new concrete form model.
  147. result # NIL
  148. TYPE Context
  149. Extension, Interface
  150. Context of a view in a form.
  151. PROCEDURE (c: Context) ThisModel (): Model
  152. Extension, Interface
  153. Returns the form which contains the context.
  154. PROCEDURE (c: Context) GetRect (VAR l, t, r, b: LONGINT)
  155. Interface
  156. Returns the bounding box of the context's view.
  157. l < r  &  t < b
  158. TYPE Reader
  159. Interface
  160. Input rider on a form model.
  161. view: Views.View
  162. Most recently read view.
  163. l, t, r, b: LONGINT    view # NIL => l < r & t < b
  164. Bounding box of most recently read view.
  165. PROCEDURE (r: Reader) Set (p: Views.View)
  166. Interface
  167. Set position of reader r to the view above p (i.e. the next view to be read will be the one directly above p) or to the bottom if p = NIL.
  168. p in Base(r)  OR  p = NIL    20
  169. PROCEDURE (r: Reader) ReadView (VAR v: Views.View)
  170. Interface
  171. Reads the next view, in ascending order. If there is none, v is set to NIL. The reader's view and l, t, r, b fields will be set accordingly (l, t, r, b are undefined if view is NIL).
  172. v = r.view
  173. TYPE Writer
  174. Interface
  175. Output rider on a form.
  176. PROCEDURE (w: Writer) Set (p: Views.View)
  177. Interface
  178. Set position of writer w to the view above p (i.e. the next view to be written will be inserted directly above p) or to the bottom if p = NIL.
  179. p in Base(r)  OR  p = NIL    20
  180. PROCEDURE (w: Writer) WriteView (v: Views.View; l, t, r, b: LONGINT)
  181. Interface
  182. Insert view v at the current position in w's form.
  183. v # NIL    20
  184. v.context = NIL    22
  185. l <= r    23
  186. t <= b    24
  187. v.context # NIL
  188. TYPE UpdateMsg
  189. Extension
  190. This message indicates that a rectangular part of a form needs to be updated on the screen.
  191. The receiver must not switch on any marks as a reaction to having received this message.
  192. UpdateMsgs are sent by concrete form model implementations after any view modifications.
  193. UpdateMsgs are not extended.
  194. VAR dir-, stdDir-: Directory;    dir # NIL  &  stdDir # NIL
  195. Form model directories.
  196. PROCEDURE GetRect (v: Views.View; VAR l, t, r, b: LONGINT)
  197. Returns the bounding box of view v, provided it is embedded in a form model.
  198. v # NIL    20
  199. v.context # NIL    21
  200. v.context IS Context    22
  201. l < r  &  t < b
  202. PROCEDURE New (): Model
  203. Returns a new model. Equivalent to dir.New().
  204. result # NIL
  205. PROCEDURE Clone (source: Model): Model
  206. Returns a new empty model of the same type as source.
  207. source # NIL    20
  208. result # NIL
  209. PROCEDURE Copy (source: Model): Model
  210. Returns a new model of the same type as source, with a copy of the contents of source.
  211. source # NIL    20
  212. result # NIL
  213. PROCEDURE SetDir (d: Directory)
  214. Assign directory.
  215. d # NIL    20
  216. dir = d
  217. TextControllers.StdCtrlDesc
  218. TextControllers.ControllerDesc
  219. Containers.ControllerDesc
  220. Controllers.ControllerDesc
  221. Helvetica
  222. Documents.ControllerDesc
  223.